class Player extends egret.EventDispatcher{
	public life:number
	public hand:BaseCard[]
	public weapons:WeaponCard[]

	public actWeapon:number = 0
	public actSkill:number = 0
	public actShield:number = 0
	private _index:0|1
	public constructor(n:0|1) {
		super()
		this.life = 3
		this.hand = []
		this.weapons = []
		this._index = n
	}

	public turnIn(){
		this.actSkill = 1
		this.actShield = 1
		this.actWeapon = 1
	}

	public turnOut(){
		this.actSkill = 0
		this.actShield = 0
		this.actWeapon = 0
	}

	public draw(card:BaseCard){
		this.hand.push(card)
	}

	public testRandom5Hand(){
		const arr = CardFactory.instance.getRandomCardExceptWeapon(5)//getNRandomCard(10)
		for(let i=0;i<arr.length;i++){
			let card = CardFactory.instance.rawData2Card(arr[i])
			card.player = this
			this.hand.push(card)
		}
	}

	public testRandomWeapon(){
		const arr = CardFactory.instance.getRandomWeapon(-1, -1, 6)
		for(let i=0;i<arr.length;i++){
			let card = CardFactory.instance.rawData2Card(arr[i]) as WeaponCard
			card.player = this
			this.weapons.push(card)
		}
	}

	public get index(){
		return this._index
	}
}